home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club (Business) 1997 July / Software of the Month Club - Business (Volume 239) (July 1997).iso / pc / code / c.dxr / 00007_Env C Logic.ls next >
Encoding:
Text File  |  1996-02-15  |  14.4 KB  |  345 lines

  1. global gWorld, gStates, gObjects, gCurKeyList, void, gCursorlist, gHaveNavs, gTempHotRects, gHotRects, gIndevelopment, sQTCharSprite, gSoundchannels
  2.  
  3. on EnterC01
  4.   if getaProp(getaProp(gObjects, #c02worker), #brokenContactLense) = #play then
  5.     MakeDynamic(#c02worker, #brokenContactLense, #done)
  6.     playSound("C02wc4.aif", #File, 1)
  7.   end if
  8. end
  9.  
  10. on EnterC03
  11.   if getaProp(getaProp(gObjects, #c02worker), #brokenContactLense) = #play then
  12.     MakeDynamic(#c02worker, #brokenContactLense, #done)
  13.     playSound("C02wc4.aif", #File, 1)
  14.   end if
  15. end
  16.  
  17. on ExitC01
  18.   nothing()
  19. end
  20.  
  21. on calcTransToC04
  22.   if not (the shiftDown) then
  23.     set voList to [#c03vowr1.aif, #c03vowr2.aif, #c03vowr3.aif, #C02wc4.aif]
  24.     repeat with thisSound in voList
  25.       stopsound(string(thisSound))
  26.     end repeat
  27.   end if
  28.   return #C04
  29. end
  30.  
  31. on calcTransToC02
  32.   if getaProp(getaProp(gStates, #BeenThere), #c02a) > 0 then
  33.     put #C02c
  34.     return #C02c
  35.   else
  36.     put #c02a
  37.     return #c02a
  38.   end if
  39. end
  40.  
  41. on GetOutOfC
  42.   set theWeather to [1: #cloudywarm, 2: #icy, 3: #snowy, 4: #thunder, 5: #rain, 6: #hot, 7: #mild, 8: #cloudycold, 0: 0]
  43.   set theCurrentWeater to getaProp(getaProp(gStates, #Conditions), #Weather)
  44.   set currentStateWeatherObj to getOne(theWeather, theCurrentWeater)
  45.   if voidp(getaProp(getaProp(gStates, #BeenThere), #d01)) and (getaProp(getaProp(gObjects, #weatherObj), #solved) = 1) then
  46.     setaProp(gStates, #leftC, 1)
  47.     genexitkf(#d01)
  48.   else
  49.     if currentStateWeatherObj = 1 then
  50.       playSound("c03vowr1.aif", #File, 1)
  51.     else
  52.       if (currentStateWeatherObj = 2) and getaProp(getaProp(gStates, #BeenThere), #d01) then
  53.         playSound("c03vowr3.aif", #File, 1)
  54.       else
  55.         if currentStateWeatherObj = 3 then
  56.           playSound("c03vowr3.aif", #File, 1)
  57.         else
  58.           if currentStateWeatherObj = 4 then
  59.             playSound("c03vowr2.aif", #File, 1)
  60.           else
  61.             if currentStateWeatherObj = 5 then
  62.               playSound("c03vowr2.aif", #File, 1)
  63.             else
  64.               if (currentStateWeatherObj = 6) or (currentStateWeatherObj = 7) or (currentStateWeatherObj = 0) then
  65.                 setaProp(gStates, #leftC, 1)
  66.                 if getaProp(getaProp(gObjects, #BBallon), #solved) = #true then
  67.                   genexitkf(#B08B)
  68.                 else
  69.                   genexitkf(#B08A)
  70.                 end if
  71.               else
  72.                 if currentStateWeatherObj = 8 then
  73.                   playSound("c03vowr1.aif", #File, 1)
  74.                 end if
  75.               end if
  76.             end if
  77.           end if
  78.         end if
  79.       end if
  80.     end if
  81.   end if
  82. end
  83.  
  84. on waitForEndQT OBJref
  85.   repeat while the movieRate of sprite sQTCharSprite
  86.     updateStage()
  87.   end repeat
  88.   Startthetimer(1, "genExitKF #c03")
  89. end
  90.  
  91. on EnterC02
  92.   global k
  93.   set voList to [#c03vowr1.aif, #c03vowr2.aif, #c03vowr3.aif, #C02wc4.aif]
  94.   repeat with thisSound in voList
  95.     stopsound(string(thisSound))
  96.   end repeat
  97.   set OBJref to #c02worker
  98.   set OBj to getaProp(gObjects, OBJref)
  99.   set the loc of the c02worker of gObjects to the normalLoc of the c02worker of gObjects
  100.   set the Hotrect of the c02worker of gObjects to the NormalRect of the c02worker of gObjects
  101.   MakeDynamic(OBJref, #howManyTimes, getaProp(getaProp(gObjects, OBJref), #howManyTimes) + 1)
  102.   set howManyTimes to getaProp(getaProp(gObjects, OBJref), #howManyTimes)
  103.   put "howManyTimes =" & howManyTimes
  104.   set k to 1
  105.   if the Weather of the Conditions of gStates = #icy then
  106.     if (the winC of the weatherObj of gObjects = 1) and voidp(getaProp(getaProp(gStates, #BeenThere), #d01)) then
  107.       put "condition 8 winC"
  108.       MakeDynamic(OBJref, #Condition, #end8)
  109.       MakeDynamic(OBJref, #State, #end8)
  110.       MakeDynamic(OBJref, #DisplayState, getaProp(OBj, #State))
  111.     else
  112.       put "condition 8"
  113.       MakeDynamic(OBJref, #Condition, 8)
  114.       set alist to [#entry8a, #entry8b, #entry8c, #entry8d]
  115.       set thisRandomMov to getAt(alist, random(count(alist)))
  116.       MakeDynamic(OBJref, #State, thisRandomMov)
  117.       MakeDynamic(OBJref, #DisplayState, getaProp(OBj, #State))
  118.     end if
  119.   else
  120.     if the Weather of the Conditions of gStates = #hot then
  121.       put "condition 8"
  122.       MakeDynamic(OBJref, #Condition, 8)
  123.       set alist to [#entry8a, #entry8b, #entry8c, #entry8d]
  124.       set thisRandomMov to getAt(alist, random(count(alist)))
  125.       MakeDynamic(OBJref, #State, thisRandomMov)
  126.       MakeDynamic(OBJref, #DisplayState, getaProp(OBj, #State))
  127.     else
  128.       if getaProp(getaProp(gObjects, OBJref), #Condition) = 0 then
  129.         set the loc of the c02worker of gObjects to the OpenLoc of the c02worker of gObjects
  130.         set the Hotrect of the c02worker of gObjects to the OpenRect of the c02worker of gObjects
  131.         MakeDynamic(OBJref, #Condition, 1)
  132.         MakeDynamic(OBJref, #State, #entry1a)
  133.         MakeDynamic(OBJref, #DisplayState, getaProp(OBj, #State))
  134.       else
  135.         if the weatherControl of the Conditions of gStates then
  136.           put "condition 7"
  137.           if getaProp(getaProp(gObjects, OBJref), #Condition) < 7 then
  138.             MakeDynamic(OBJref, #Condition, 7)
  139.             MakeDynamic(OBJref, #howManyTimes, 1)
  140.             MakeDynamic(OBJref, #State, 7)
  141.             MakeDynamic(OBJref, #DisplayState, getaProp(OBj, #State))
  142.           else
  143.             set alist to [#entry7a, #entry7b, #entry7c]
  144.             set thisRandomMov to getAt(alist, random(count(alist)))
  145.             MakeDynamic(OBJref, #State, thisRandomMov)
  146.             MakeDynamic(OBJref, #DisplayState, getaProp(OBj, #State))
  147.           end if
  148.         else
  149.           if getaProp(getaProp(gObjects, OBJref), #metCondition6) and getaProp(getaProp(gObjects, OBJref), #met2) then
  150.             put "condition 6"
  151.             if voidp(getaProp(getaProp(gObjects, OBJref), #met6)) then
  152.               MakeDynamic(OBJref, #met6, 1)
  153.               MakeDynamic(OBJref, #Condition, 6)
  154.               MakeDynamic(OBJref, #howManyTimes, 1)
  155.               set howManyTimes to getaProp(getaProp(gObjects, OBJref), #howManyTimes)
  156.               setaProp(getaProp(gObjects, OBJref), #ConCount, 0)
  157.             end if
  158.             if howManyTimes > 5 then
  159.               set thisProp to #entry6f
  160.             else
  161.               set thisProp to getaProp([1: #entry6a, 2: #entry6b, 3: #entry6c, 4: #entry6d, 5: #entry6e], howManyTimes)
  162.             end if
  163.             MakeDynamic(OBJref, #State, thisProp)
  164.             MakeDynamic(OBJref, #DisplayState, getaProp(OBj, #State))
  165.           else
  166.             if getaProp(gStates, #redHerring) and getaProp(getaProp(gObjects, OBJref), #met3) and getaProp(gStates, #leftC) then
  167.               put "condition 5"
  168.               MakeDynamic(OBJref, #Condition, 5)
  169.               MakeDynamic(OBJref, #State, #entry5)
  170.               MakeDynamic(OBJref, #DisplayState, getaProp(OBj, #State))
  171.             else
  172.               if voidp(getaProp(gStates, #redHerring)) and getaProp(getaProp(gObjects, OBJref), #met3) and getaProp(gStates, #leftC) then
  173.                 put "condition 4"
  174.                 MakeDynamic(OBJref, #Condition, 4)
  175.                 MakeDynamic(OBJref, #State, #entry4)
  176.                 MakeDynamic(OBJref, #DisplayState, getaProp(OBj, #State))
  177.               else
  178.                 if (the solved of the ThermometerOBJ of gObjects = #false) and (the solved of the windspeedObj of gObjects = #false) and (the solved of the EastWestTempObj of gObjects = #false) and not (getaProp(getaProp(gStates, #BeenThere), #c08) and getaProp(getaProp(gStates, #BeenThere), #c09) and getaProp(getaProp(gStates, #BeenThere), #c10)) and getaProp(getaProp(gObjects, OBJref), #met2) and (howManyTimes > 3) and (getaProp(gStates, #leftC) = 1) then
  179.                   put "condition 3"
  180.                   MakeDynamic(OBJref, #Condition, 3)
  181.                   MakeDynamic(OBJref, #met3, 1)
  182.                   MakeDynamic(OBJref, #State, #entry3)
  183.                   MakeDynamic(OBJref, #DisplayState, getaProp(OBj, #State))
  184.                 else
  185.                   put "condition 2"
  186.                   MakeDynamic(OBJref, #Condition, 2)
  187.                   MakeDynamic(OBJref, #met2, 1)
  188.                   setaProp(getaProp(gObjects, OBJref), #ConCount, 0)
  189.                   if howManyTimes = 1 then
  190.                     set the loc of the c02worker of gObjects to the OpenLoc of the c02worker of gObjects
  191.                     set the Hotrect of the c02worker of gObjects to the OpenRect of the c02worker of gObjects
  192.                     set thisProp to #entry1a
  193.                   else
  194.                     if howManyTimes = 2 then
  195.                       set thisProp to #entry2b
  196.                       MakeDynamic(#c02worker, #brokenContactLense, #play)
  197.                     else
  198.                       if howManyTimes = 3 then
  199.                         set thisProp to #entry2c
  200.                       else
  201.                         if howManyTimes > 3 then
  202.                           set thisProp to #entry2D
  203.                         end if
  204.                       end if
  205.                     end if
  206.                   end if
  207.                   MakeDynamic(OBJref, #State, thisProp)
  208.                   MakeDynamic(OBJref, #DisplayState, getaProp(OBj, #State))
  209.                 end if
  210.               end if
  211.             end if
  212.           end if
  213.         end if
  214.       end if
  215.     end if
  216.   end if
  217. end
  218.  
  219. on doC02workerVid
  220.   set OBJref to #c02worker
  221.   set myObj to getaProp(gObjects, OBJref)
  222.   set howManyTimes to getaProp(getaProp(gObjects, OBJref), #howManyTimes)
  223.   set the loc of the c02worker of gObjects to the normalLoc of the c02worker of gObjects
  224.   set the Hotrect of the c02worker of gObjects to the NormalRect of the c02worker of gObjects
  225.   if getaProp(getaProp(gObjects, OBJref), #Condition) = 1 then
  226.     set the loc of the c02worker of gObjects to the OpenLoc of the c02worker of gObjects
  227.     set the Hotrect of the c02worker of gObjects to the OpenRect of the c02worker of gObjects
  228.     MakeDynamic(OBJref, #State, 1)
  229.     MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  230.   else
  231.     if getaProp(getaProp(gObjects, OBJref), #Condition) = 2 then
  232.       if the howManyTimes of myObj = 2 then
  233.         put "howManytimes=" && howManyTimes
  234.         MakeDynamic(OBJref, #State, 2)
  235.         MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  236.       else
  237.         if the howManyTimes of myObj > 2 then
  238.           MakeDynamic(OBJref, #State, #b2)
  239.           MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  240.         end if
  241.       end if
  242.     else
  243.       if getaProp(getaProp(gObjects, OBJref), #Condition) = 3 then
  244.         MakeDynamic(OBJref, #State, 3)
  245.         MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  246.       else
  247.         if getaProp(getaProp(gObjects, OBJref), #Condition) = 4 then
  248.           MakeDynamic(OBJref, #State, 4)
  249.           MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  250.         else
  251.           if getaProp(getaProp(gObjects, OBJref), #Condition) = 5 then
  252.             MakeDynamic(OBJref, #State, 5)
  253.             MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  254.           else
  255.             if getaProp(getaProp(gObjects, OBJref), #Condition) = 6 then
  256.               if the howManyTimes of myObj = 1 then
  257.                 MakeDynamic(OBJref, #State, 6)
  258.                 MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  259.               else
  260.                 if the howManyTimes of myObj = 2 then
  261.                   MakeDynamic(OBJref, #State, #a6)
  262.                   MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  263.                 else
  264.                   if the howManyTimes of myObj = 3 then
  265.                     MakeDynamic(OBJref, #State, #b6)
  266.                     MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  267.                   else
  268.                     if the howManyTimes of myObj = 4 then
  269.                       MakeDynamic(OBJref, #State, #c6)
  270.                       MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  271.                     else
  272.                       if the howManyTimes of myObj = 5 then
  273.                         MakeDynamic(OBJref, #State, #d6)
  274.                         MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  275.                       else
  276.                         if the howManyTimes of myObj = 6 then
  277.                           MakeDynamic(OBJref, #State, #e6)
  278.                           MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  279.                         end if
  280.                       end if
  281.                     end if
  282.                   end if
  283.                 end if
  284.               end if
  285.             else
  286.               if getaProp(getaProp(gObjects, OBJref), #Condition) = 7 then
  287.                 if the howManyTimes of myObj = 1 then
  288.                   set thisRandomMov to 7
  289.                 else
  290.                   set alist to [#entry7a, #entry7b, #entry7c]
  291.                   set thisRandomMov to getAt(alist, random(count(alist)))
  292.                 end if
  293.                 MakeDynamic(OBJref, #State, thisRandomMov)
  294.                 MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  295.               else
  296.                 if getaProp(getaProp(gObjects, OBJref), #Condition) = 8 then
  297.                   set alist to [#entry7a, #entry7c]
  298.                   set thisRandomMov to getAt(alist, random(count(alist)))
  299.                   MakeDynamic(OBJref, #State, thisRandomMov)
  300.                   MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  301.                 else
  302.                   if getaProp(getaProp(gObjects, OBJref), #Condition) = #end8 then
  303.                     MakeDynamic(OBJref, #State, #end8)
  304.                     MakeDynamic(OBJref, #DisplayState, getaProp(myObj, #State))
  305.                   end if
  306.                 end if
  307.               end if
  308.             end if
  309.           end if
  310.         end if
  311.       end if
  312.     end if
  313.   end if
  314.   DoCharacterMovie(OBJref)
  315. end
  316.  
  317. on EnterC08
  318.   if getaProp(getaProp(gStates, #BeenThere), #c08) = 0 then
  319.     Startthetimer(30, "playSound " & QUOTE & "C08vowrk.aif" & QUOTE & ",#file, 1", #ThermometerOBJ)
  320.   end if
  321.   if getaProp(getaProp(gObjects, #BRocket), #solved) = #true then
  322.     MakeDynamic(#ThermometerOBJ, #State, #on)
  323.   else
  324.     MakeDynamic(#ThermometerOBJ, #State, #off)
  325.   end if
  326.   turnOnObj(#ThermometerOBJ)
  327.   if getaProp(getaProp(gStates, #BeenThere), #c10) > 0 then
  328.     if (the State of the ThermometerOBJ of gObjects = #off) and (the State of the EastWestTempObj of gObjects = #off) then
  329.       PDARelease("J04m03p.mov")
  330.     end if
  331.   end if
  332. end
  333.  
  334. on EnterC09
  335.   if getaProp(getaProp(gStates, #BeenThere), #c09) = 0 then
  336.     Startthetimer(30, "playSound " & QUOTE & "C09vowrk.aif" & QUOTE & ", #file, 1", #windspeedObj)
  337.   end if
  338.   MakeDynamic(#windspeedObj, #State, #on)
  339.   turnOnObj(#windspeedObj)
  340. end
  341.  
  342. on ExitC09
  343.   DelObjects([getaProp(getaProp(gObjects, #windSpeedgraph), #State)])
  344. end
  345.